#include<cstdio>
#include<cstring>
#define CC(A,x) memset(A,x,sizeof(A))
const int KIND=26;
const int mod=20090717;

int chd[110][KIND],fail[110],flag[110],q[110];
int N,M,K,ans,size,f[2][110][2048],c;

void init()
{
	CC(chd,0);
	CC(fail,0);
	CC(flag,0);
	size=1;
	ans=0;
	CC(f,0);
	c=0;
}

void insert(char *ch,int n)
{
	int i=0,t,p=0;
	while(ch[i])
	{
		t=ch[i]-'a';
		if(chd[p][t]==0)chd[p][t]=size++;
		p=chd[p][t];
		i++;
	}
	flag[p]=1<<(n-1);
}
void Insert(char *a,int key) {
		int p = 0;
		for ( ; *a ; a ++) {
			int c = *a-'a';
			if (!chd[p][c]) {
				memset(chd[size] , 0 , sizeof(chd[size]));
				//[size] = 0;
				chd[p][c] = size ++;
			}
			p = chd[p][c];
		}
		flag[p] = key;
	}

void AC()
{
	int l=1,r=1;
	q[1]=0;
	while(l<=r)
	{
		int t=q[l];l++;
		for(int i=0;i<KIND;i++)
		{
			int tem=chd[t][i];
			if(tem)
			{
				if(t>0)
				{
					fail[tem]=chd[fail[t]][i];
				}
				r++;q[r]=tem;
				flag[tem] |= flag[fail[tem]];
			}
			else
			{
				if(t>0)
				{
					chd[t][i]=chd[fail[t]][i];
				}
			}
		}
	}
}
bool check(int n)
{
	int cnt=0;
	while(n>0)
	{
		if(n%2)cnt++;
		n/=2;
	}
	if(cnt>=K)return true;
	return false;
}
void DP()
{
	f[0][0][0]=1;
	for(int i=0;i<N;i++)
	{
		CC(f[(i+1)%2],0);
		for(int j=0;j<size;j++)
			for(int k=0;k<(1<<M);k++)
				if(f[i%2][j][k]>0)
				{
					c++;
					for(int s=0;s<KIND;s++)
					{
						int p=chd[j][s];
						int st=k|flag[p];
						f[(i+1)%2][p][st]=(f[(i+1)%2][p][st]+f[i%2][j][k])%mod;
					}
				}
	}
	for(int j=0;j<size;j++)
		for(int k=0;k<(1<<M);k++)
			if(check(k))
			ans=(ans+f[N%2][j][k])%mod;
}
int main()
{
	while(scanf("%d%d%d",&N,&M,&K),N+M+K)
	{
		init();
		for(int i=1;i<=M;i++)
		{
			char t[20];
			scanf("%s",t);
			Insert(t,1<<(i-1));
		}
		//Construct();
		AC();
		DP();

		printf("%d\ncnt=%d\n",ans,c);
	}
}
